home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / SKYNT017.422 < prev    next >
Text File  |  1993-02-22  |  5KB  |  143 lines

  1. I find this helpful, maybe you will too....
  2. The Terminator #264 @13478
  3. Fri Feb 19 12:17:10 1993
  4. ┌────────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name: SKYNT017.MOD     Mod Author :  The Terminator                    │
  6. │                                          Skynet BBS 314-352-8584           │
  7. │ Difficulty: "Can You Block Copy?" Date: 15 February 1993                   │
  8. │ WWIV Version: 4.20e  (CAUTION may require adapting to new Versions!)       │
  9. │ Files Affected: XFER.C, BBS.C, VARDEC.H                                    │
  10. │ Description: Allows selective deletion of files in Download Directories    │
  11. │              by age or Sysop's discretion.                                 │
  12. └────────────────────────────────────────────────────────────────────────────┘
  13.  
  14.     I wrote this to allow a fast means of deleting old or unwanted uploads
  15. from Skynet's Download Directories. It also automatically adds the file to
  16. my TRASHFYL.DAT and prohibits it from being re-uploaded. If you have my
  17. TRASHFYL.MOD (SKYNT008.MOD), simply remove the comments to make it active.
  18.  
  19.     All you have to do is type //PURGE in the Transfer Menu. You will
  20. be prompted for a month number. Simply add the month number such as "03" 
  21. for March, with a slash. "ie: 03/" The Mod will display the file info for all
  22. files in the directory that were uploaded during March, and prompt for deletion
  23. of each one individually. The Mod is limited to the current Sub you are in,
  24. so you have to move to each sub you wish to "Purge".
  25.  
  26.     If you wish to scan all the files in sequence in the sub, simply enter
  27. an asterik "*" when you are prompted for the month. The Mod will then present
  28. each file in the current sub, for review.
  29. /**************************************************************************/
  30.  
  31. Open XFER.C: Block copy the following function at the end of the module.
  32.  
  33.  
  34. void date_purge()
  35. {
  36.  
  37. /*  FILE *trash;                            TRASHFYL.MOD */
  38.  
  39.   int i,i1,i2,ok;
  40.   char ch,s[81],s1[81],s2[81];
  41.   uploadsrec u;
  42.  
  43.   dliscan();
  44.   nl();
  45.   prt(6," File Month to remove.");
  46.   outstr(":");
  47.   mpl(4);
  48.   input(s,4);
  49.   if (s[0]==0) {
  50.     closedl();
  51.     return;
  52.   }
  53.  
  54.   SETREC(0);
  55.   read(dlf,(void *)&u,sizeof(uploadsrec));
  56.   i2=numf;
  57.   i=1;
  58.   while ((i<i2)) {
  59.     SETREC(i);
  60.     read(dlf,(void *)&u,sizeof(uploadsrec));
  61.       if ((strncmp(s,u.date,3)==0) || (strcmp(s,"*")==0)) {
  62.     printfileinfo(&u,udir[curdir].subnum);
  63.     prt(2,"Purge this File (Y/N/Q)");
  64.     ch=onek("YNQ");
  65.     if (ch=='Q')
  66.        return;
  67.     if (ch=='Y') {
  68.  
  69.  /*      sprintf(s2,"%s\n",u.filename);                   TRASHFYL.MOD */
  70.  /*      sprintf(s1,"%sTRASHFYL.DAT",syscfg.gfilesdir);      "      "  */ 
  71.  /*      if((trash = fopen(s1,"at")) == NULL)                "      "  */
  72.  /*      prt(6,"Can't Open Trashfyl.Dat\n\r");               "      "  */
  73.  /*      fputs(s2,trash);                                    "      "  */
  74.  /*      fclose(trash);                                      "      "  */
  75.  
  76.        sprintf(s1,"%s%s",directories[udir[curdir].subnum].path,u.filename);
  77.      unlink(s1);
  78.       if (u.mask & mask_extended)
  79.         delete_extended_description(u.filename);
  80.       sprintf(s1,"-%s Removed off of %s",u.filename,
  81.                 directories[udir[curdir].subnum].name);
  82.       sysoplog(s1);
  83.       for (i1=i; i1<numf; i1++) {
  84.         SETREC(i1+1);
  85.         read(dlf,(void *)&u,sizeof(uploadsrec));
  86.         SETREC(i1);
  87.         write(dlf,(void *)&u,sizeof(uploadsrec));
  88.       }
  89.       --i;
  90.       --numf;
  91.       SETREC(0);
  92.       read(dlf, &u, sizeof(uploadsrec));
  93.       u.numbytes=numf;
  94.       SETREC(0);
  95.       write(dlf,(void *)&u,sizeof(uploadsrec));
  96.     }
  97.    }
  98.   ++i;
  99.   }
  100.   closedl();
  101.   return;
  102. }
  103.  
  104.  
  105. Close XFER.C, your done here.
  106.  
  107. Open BBS.C: Move down to the "dlmainmenu" function and add a call to the 
  108.             Purge function. You can add it right before the "/O" test.
  109.  
  110.  
  111.     if ((strcmp(s,"PURGE")==0) && (dc()))      /* MOD ADD */
  112.         date_purge();                          /* MOD ADD */
  113.     if (strcmp(s,"/O")==0)
  114.  
  115. Close BBS.C, you done here also.
  116.  
  117. Now just open VARDEC.H and add the function declaration and your done with
  118. everything. If you don't know, you can add the declaration anywhere, but
  119. it's easier to keep track if you place it with the other Xfer.C declarations.
  120. Just add "void date_purge();" at the bottom of the list for Xfer.C. This
  121. will force a full re-compile, but can't be helped.
  122.  
  123. WARNING: I have not upgraded to 4.22, mostly because I like what I've done
  124.          with 4.20e (and so do my Users) and I have made over 150+ mods to
  125.          my source. (Moving them to 4.22 is too much like work!) With just
  126.          a little knowledge of C programming, you should be able to adapt
  127.          any of my mods to most versions of WWIV
  128.  
  129. /***************************************************************************/
  130.  
  131.  
  132.     That's it kiddies. Wasn't so tough was it? This works fine in 4.20e
  133. but I can't promise anything else. I've had a couple of my earlier mods act
  134. funny in 4.21/22. Mostly because of supporting function calls that had changes
  135. in them. So............. if you catch your foreskin in your zipper, if your
  136. hard drive seeks psychiatric help, or if you or any of your I.M. Force should
  137. be caught or killed, the Secretary will dissavow any knowledge of your actions. 
  138.  
  139.  
  140.                It's not my problemo!
  141.  
  142.  
  143.